<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--[if lt IE 7 ]> <html class="no-js ie6"> <![endif]-->
<!--[if IE 7 ]>    <html class="no-js ie7"> <![endif]-->
<!--[if IE 8 ]>    <html class="no-js ie8"> <![endif]-->
<!--[if IE 9 ]>    <html class="no-js ie9"> <![endif]-->
<!--[if (gt IE 9)|!(IE)]><!-->
<html class="no-js">
<!--<![endif]-->
<head>
	<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
	<title>商品购买 - 医通在线</title>
	<link href="templates/css/global.css" rel="stylesheet" type="text/css" />
	<link href="templates/css/agency.css" rel="stylesheet" type="text/css" />
	<meta content="" name="Keywords">
	<meta name="description" content="" />
    <script src="templates/js/jquery-1.3.2.min.js" type="text/javascript"></script>
	<script language="JavaScript" type="text/javascript" src="templates/js/My97DatePicker/WdatePicker.js"></script>
    <script src="templates/js/form.js" type="text/javascript"></script>
    <script src="templates/js/common.js" type="text/javascript"></script>


<!--[if IE 6]>
	<script src="templates/js/ddpng.js" type="text/javascript"></script>
	<script type="text/javascript">DD_belatedPNG.fix('.ddpng');</script>
    <![endif]-->
</head>
<body>
<style>
.num_cut,.num_add{
    border:1px solid #a7a6ab;
    height:34px;
    width:36px;
    padding:2px;
    font-size:20px;
    cursor:pointer;
}
.num_add{
    margin-right:10px;
}
.info_box a.btn_fin{
    background-position:-176px -376px;
}

#total_price{
    color : red;
    font-size: 26px;
    font-weight: bold;
}
</style>
<!--header st-->
<{include file="../templates/$newtpl/header.html"}>
<FORM style="margin-top:5px" action="/index.php?action=kouqiang_doso"  method="post" name="appendform" id="kqform">
<div class="row mb10 center_layout fix">
	<{include file="../templates/$newtpl/left.html"}>
	<div class="grid0 grid770">
		<div class="main_con">
			<div class="subline"><h4>自费洁牙</h4></div>
			<div class="step">
			<img src="../templates/images/D-01.gif" />
			</div>

			<div class="con info_box" id="yuangdiv"  name="yuangdiv">
				<dl class="form">
				    <dd>
					  <label class="label"><em class="red">*</em> 商品：</label>
							 <div style="padding-left:120px"><b><{$productInfo.product_name}></b></div>
                    </dd>

                    <dd><label class="label"><em class="red">*</em> 购买数量：</label>
                    <input type="button" class="num_cut" value="-"/><input name="num" type="text" class="input" id="num" value="1" style="ime-mode:Disabled;margin:0 20px;width:35px;text-align:center;" readonly=true/><input type="button" class="num_add" value="+"/><span class="fault">(必填)</span></dd>

					<dd>
                        <label class="label"><em class="red">*</em> 收货人姓名：</label>
                        <input name="receiver_name" type="text" class="input" id="receiver_name" value="<{$userinfo.user_realname}>" /><span class="fault">(必填)</span></dd>

				    <dd><label class="label"><em class="red">*</em> 手机：</label><input name="tel" type="text" class="input" id="tel" value="<{$userinfo.user_tel}>" /><span class="fault">(必填)</span></dd>

                    <dd><label class="label"><em class="red">*</em> 城市：</label>
                        <select id='province' name="province">
                            <option value="">请选择</option>
                            <option value="2">北京</option>
                            <option value="25">上海</option>
                            <option value="76">广州</option>
                            <option value="383">杭州</option>
                            <option value="53">福州</option>
                            <option value="32">重庆</option>
                            <option value="311">西安</option>
                            <option value="283">济南</option>
                            <option value="244">沈阳</option>
                            <option value="27">天津</option>
                            <option value="180">武汉</option>
                            <option value="322">成都</option>
                            <option value="220">南京</option>
                            <option value="77">深圳</option>
                            <option value="149">郑州</option>
                            <option value="367">昆明</option>
                            <option value="351">乌鲁木齐</option>
                            <option value="167">哈尔滨</option>
                            <option value="197">长沙</option>
                            <option value="300">太原</option>
                            <{*foreach item=province from=$provinceList*}>
                                <!-- <option value="<{$province.id}>"><{$province.name}></option> -->
                            <{*/foreach*}>
                            <!-- <option value="9999">其他</option> -->
                        </select>

                        <!-- <select name="city">

                        </select>

                        <select name="district">

                        </select> -->

                    <span class="fault">(必填)</span></dd>

                    <dd><label class="label"><em class="red">*</em> 收货地址：</label><input name="rec_address" type="text" class="input" id="rec_address" value="" style="width:280px"/><span class="fault">(必填)</span></dd>

                   <dd><label class="label">是否需要发票：</label>
                        <input name="invoice" type="radio"  value="1" />是
                        <input name="invoice" type="radio" checked=true value="0" />否
                     </dd>


                    <dd id='invoiceDd0' class="dn"><label class="label">发票类型：</label>
                        <input name="invoice_type" type="radio"  value="1" checked=true />个人
                        <input name="invoice_type" type="radio"  value="2" />企业
                    </dd>

                    <dd id='invoiceDd1' class="dn"><label class="label"> 发票抬头：</label><input name="invoice_header" type="text" class="input" id="invoice_header" value="<{$userinfo.user_realname}>" style="width:280px"/></dd>

                    <dd id='invoiceDd2' class="dn">
                        <label class="label"> 发票内容：</label>
                        <input name="invoice_content" type="radio"  value="医通在线健康管理应用服务洗牙服务费" checked="true" />医通在线健康管理应用服务洗牙服务费
                        <br/>
                        <label class="label">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</label>
                        <input name="invoice_content" type="radio"  value="医通在线健康管理应用服务体检服务费" />医通在线健康管理应用服务体检服务费
                        <br/>
                        <label class="label">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</label>
                        <input name="invoice_content" type="radio"  value="医通在线健康管理应用服务咨询服务费" />医通在线健康管理应用服务咨询服务费

                    </dd>

                    <dd><label class="label">总价格：</label><span id='total_price'><{$productInfo.product_yg_price}></span></dd>


				   <dd><label class="label">说明：</label>请在下单后45分钟内完成付款，否则订单将失效。</dd>

				   <dd><label class="label">&nbsp;</label>
				   <input name="product_code" type="hidden" value="<{$productInfo.product_sign}>">
				   <a href="javascript:void(0);" onClick="doso();" title="购 买" class="btn_fin"></a>
				   </dd>
		  </div>


            <input type='hidden' id='danjia' value="<{$productInfo.product_yg_price}>"/>

    </div>
</div>
</div>
</form>
<{include file="../templates/$newtpl/foot.html"}>

<!--脚本如下-->
<script src="templates/js/jquery-1.7.2.min.js" type="text/javascript"></script>
<script src="templates/js/jquery.validate.js" type="text/javascript"></script>
<script src="templates/js/global.js" type="text/javascript"></script>

<script type="text/javascript">
var provinceList = <{$jsProvinceList}>;

function total_price(num){
    var danjia = parseInt($('#danjia').val());
    return (danjia*num).toFixed(1);
}
$(function(){
    $('input[name=invoice]:radio').click(function(){
        if( $(this).val() == 1){
            $('#invoiceDd0,#invoiceDd1,#invoiceDd2').removeClass('dn');
        }else{
            $('#invoiceDd0,#invoiceDd1,#invoiceDd2').addClass('dn');
        }

    });

    $('.num_cut').click(function(){
        var num = parseInt($('#num').val());
        if( num == 1) return false;
        $('#num').val(--num);
        $('#total_price').html(total_price(num));
    });
    $('.num_add').click(function(){
        var num = parseInt($('#num').val());
        if( num == 99) return false;
        $('#num').val(++num);
        $('#total_price').html(total_price(num));
    });

    /*$('input[name="invoice_type"]').click(function(){
        if( this.value == 1){
            $('#invoice_header').val($('#receiver_name').val());
        }else{
            $('#invoice_header').val('');
        }
    });*/
jQuery.validator.addMethod("telphoneValid", function(value, element) {
    var tel = /^(((13[0-9]{1})|(15[0-9]{1})|(18[0-9]{1}))+\d{8})$/;
    return tel.test(value) || this.optional(element);
}, "请输入正确的手机号码");

    $('#kqform').validate({
        rules: {
            num: {
                required: true,
                digits:true
            },
            receiver_name: {
                required: true
            },
            tel: {
				required: true,
                telphoneValid: true
            },
            province : {
                required : true
            },
            rec_address: {
                required: true
            },
            topic: {
                required: "#newsletter:checked",
                minlength: 2
            },
            invoice_header:{
                required : "input[name='invoice'][value=1]",
                minlength: 1
            },
            invoice_content:{
                required : "input[name='invoice'][value=1]"
            }
        },
        messages: {
            num: {
                required: "必须输入",
                digits: "输入正整数"
            },
            receiver_name: {
                required: "收货人姓名必须输入"
            },
            tel: {
                required: "手机必须输入"
            },
            province : {
                required : "请选择城市"
            },
            rec_address: {
                required : "收货地址必须输入"
            },
            invoice_header:{
                 required : "请输入抬头"
            },
            invoice_content:{
                required : "请选择发票内容"
            }
        },
		submitHandler:function(form) {
			form.submit();
		}
    });

    $('#province').change(function(){console.log($(this));
        var selectedText = $('#province option:selected').text();
        if( selectedText == '其他'){
            alert('温馨提示：瑞尔洁牙卡只能在17个指定城市中使用。详见机构列表。');
        }
    });
});

function doso(){

    $('#kqform').submit();
}

</script>

</body>
</html>